package edu.hawaii.senin.iclouds.simple;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

/**
 * Tests appropriate coniguration parsing.
 * 
 * @author Administrator.
 * 
 */
public class TestCloudConfig {

  /**
   * Fixing the cloud instance.
   */
  Cloud testCloud = new Cloud();

  /**
   * Tests correct variables extraction.
   * 
   */
  @Test
  public void testConfigLoad() {

    try {
      testCloud.loadConfig("config/cloud.simple.config.xml");
    }
    catch (ReadConfigException e) {
      System.out.println("Got error parsing config file!");
      e.printStackTrace();
    }

    // <temperature>10</temperature>
    assertEquals("Testing cloud Temperature", Double.valueOf(10E+0), testCloud.getTemperature());
    // <density>1E3</density>
    assertEquals("Testing cloud Density", Double.valueOf(1E+3), testCloud.getDensity());
    // <number_sites>1E06</number_sites>
    assertEquals("Testing cloud N sites", Double.valueOf(1E+6), testCloud.getNSites());
    // <grain_size>10000</grain_size>
    assertEquals("Testing cloud Abundance", Double.valueOf(1E+4), testCloud.getGrainSize());
    // <iteration_limit>10000</iteration_limit>
    assertEquals("Testing cloud Abundance", 10000, testCloud.getIterationLimit());
  }

}
